package org.wmq.transferordersystem.contrller;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wmq.transferordersystem.model.Entity.Logistics;
import org.wmq.transferordersystem.model.Entity.Result;
import org.wmq.transferordersystem.service.LogisticsService;

@RestController
@RequestMapping("/logistics")
@RequiredArgsConstructor
public class LogisticsController {
    private final LogisticsService logisticsService;

    @PostMapping
    public Result<Void> saveLogistics(@RequestBody Logistics logistics) {
        boolean success = logisticsService.save(logistics);
        if (success) {
            return Result.ok();
        }
        return Result.error("保存失败");
    }
}
